/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Table;

import Boundary.Presensi;
import Boundary.TU;
//import Boundary.siswa;

import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author fave
 */
public class SiswaTabelModel extends AbstractTableModel{
    private List<TU> gr = new ArrayList<TU>();

    public SiswaTabelModel(List<TU> gr) {
        this.gr = gr;
    }

   

    public int getRowCount() {
        return this.gr.size();
    }

    public int getColumnCount() {
        return 6;
    }

    public Object getValueAt(int rowIndex, int columnIndex) {
        TU s = gr.get(rowIndex);

        switch (columnIndex)
        {
            case 0: return s.getNama().getNama();
            case 1: return s.getNis().getNIS();
            case 2: return s.getKelas().getKelas();
            case 3: return s.getIjin().getIjin();
            case 4: return s.getSakit().getSakit();
            case 5: return s.getTidakmasuk().getTidakmasuk();
            default: return "";
        }
    }

    @Override
    public String getColumnName(int columnIndex){
        switch (columnIndex){
            case 0: return "Nama";
            case 1: return "Nis";
            case 2: return "kelas";
            case 3: return "Ijin";
            case 4: return "Sakit";
            case 5: return "TidakHadir";
            default: return "";
        }
    }
}
